<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/view/system/common/head.jsp"%>

<style>
 .labelTd{
    width:100px;
    text-align:right;
 }
</style>
<body>
	<form id="parameterUpdateForm" name="parameterUpdateForm" method="post">
		<div id="p" class="easyui-panel" title="编辑参数项" 
			style="padding: 10px; background: #fafafa;text-align:center;">
			<fieldset>
				<legend style="color: blue;font-size:1.5"> 参数信息 </legend>
				<table class="infoTable">
					<tr>
						<td class="labelTd">
							<input type="hidden" name="id" value="${parameter.id}" />
							<input type="hidden" name="parentId" value="${parameter.parentId}" />
							参数名称：</td>
						<td  class="redText">
							${parentParameter.name}</td>
						<td  class="labelTd">参数编码：</td>
						<td class="redText">
							${parentParameter.code}</td>
					</tr>
				</table>
			</fieldset>
			<fieldset>
				<legend style="color: blue;font-size:1.5">参数项信息 </legend>
				<table class="infoTable">
					<tr>
						<td  class="labelTd">名称<span class="colrRed"> * </span>：
						</td>
						<td ><input type="text" id="newParameter_name"
							name="name" maxlength="30"
							class="easyui-validatebox myinput" required="true"
							value="${parameter.name}" /></td>
						<td  class="labelTd">参数值<span class="colrRed"> * </span>：
						</td>
						<td ><input type="text" id="newParameter_value"
							name="value" class="easyui-validatebox myinput"
							 maxlength="15"
							  placeholder="请输入参数值" missingMessage="请输入参数值" 
							required="true" value="${parameter.value}"/></td>
					</tr>
				</table>
			</fieldset>
			<div style="text-align:center;">
				<br /> <a  class="easyui-linkbutton myLink" iconCls="icon-ok"
					onclick="submitForm()">修改 </a>
				&nbsp;&nbsp;&nbsp; <a class="easyui-linkbutton myLink"
					iconCls="icon-undo" onclick="resetFrom()">重置</a>
			</div>
		</div>
	</form>
</body>
<script>
	//重置
	function resetFrom() {
		$("#parameterUpdateForm").form("reset");
	}

	//页面提交
	function submitForm() {
		//判断参数是否为空
		var valid = $('#parameterUpdateForm').form('validate');
		if (valid) {
			//获取页面上所有的参数
			//var param = getFormElementsForUrl();
			//提交后台处理  
			//$.post("doSubParameterUpdate.action" + param, callbackUpdate);
			var param = $("#parameterUpdateForm").serializeJson(true);
			$.axs("parameter/doSubParameterUpdate.action", param,
		            function(data){
				if(data.status == 1){
					$.messager.alert("提示信息",data.msg, 'info', function() {
						parent.$("#dataShow").datagrid('reload');
						location.reload();
					});
				}else{
					$.messager.alert("提示信息", data.msg, 'error');
				}
			});	
		}
	}


</script>
</html>